<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Poorcoverage2,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException,java.sql.*" %>
<%@ include file="../include/jsp/head.jsp"%>
<%
      if(!globa.userSession.hasRight("20010"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
      String path = request.getContextPath();
      String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
	 //初始化
    Poorcoverage2  Poorcoverage20=null;
    Poorcoverage2 obj=new Poorcoverage2(globa);
    
    //查询条件
    String  strCity=ParamUtil.getString(request,"city","").trim();//获取城市名
    String strCountry = ParamUtil.getString(request,"country","").trim();//获取区县
    String classOneAc = ParamUtil.getString(request,"classone","").trim();//获取一级热点
    String timedegree = ParamUtil.getString(request,"timedegree","").trim();//获取时间粒度
    String strStartTime1 = ParamUtil.getString(request,"strStartTime","").trim();//获取开始时间
    String strEndTime1 = ParamUtil.getString(request,"strEndTime","").trim();//获取结束时间
       String strStartTime = strStartTime1;
    String strEndTime = strEndTime1;
     System.out.println("%%%%%%%%%%%%%%%"+strEndTime);
     if(strStartTime1.compareTo(strEndTime1)>0)
       {
          out.print("<script>alert('起始时间大于终止时间，请重新输入');window.history.back(-1);</script>");  	
        }
       if(strStartTime1 !=null && !strStartTime1.equals("")){
    String[] ST = strStartTime1.trim().split(" ");
    String[] ST2 = ST[0].split("-");
    if(ST2[0].length()==4){
    strStartTime1 = ST2[2] + "-"+ ST2[1] + "-" + ST2[0].substring(2)+" "+ST[1];
    }
     }
     if(strEndTime !=null && !strEndTime.equals("")){
    String[] ET = strEndTime.split(" ");
     String[] ET2 = ET[0].split("-");
     if(ET2[0].length()==4){
    strEndTime1 = ET2[2] + "-"+ ET2[1] + "-" + ET2[0].substring(2)+" "+ET[1];
    }
    }
   
    String tWhere="  WHERE 1=1 ";
	if (!strCity.equals("") && strCountry.equals("")) {
		tWhere += " and strcity LIKE '%" + strCity + "%'";
	}
	else if(strCity.equals("") && !strCountry.equals("")){
	    tWhere += "  and strcountry LIKE '%" + strCountry + "%'";
	    }
	    else if(!strCity.equals("") && !strCountry.equals("")){
	    tWhere += " and strcity LIKE '%" + strCity + "%' and strcountry LIKE '%" + strCountry + "%' ";
	    }
	    if(!classOneAc.equals(""))tWhere += " and classoneac LIKE '"+classOneAc+"' ";
	ResultSet rs = null;
	Statement stmt = null;
	Connection conn = null;
	//记录总数
	int intAllCount=obj.getCount12(tWhere);	
	//当前页
    int intCurPage=globa.getIntCurPage();
	//每页记录数
	String strPageSize = ParamUtil.getString(request,"strPageSize","10");
    int intPageSize;
    if(strPageSize.equals("所有"))intPageSize = intAllCount;
      else  intPageSize = Integer.parseInt(strPageSize);
		//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;  
	//获取到当前页面的记录集
	Vector<Poorcoverage2> vctObj=obj.list12(timedegree,tWhere,intStartNum,intPageSize,strStartTime1,strEndTime1);
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
   //获取所有城市名称 

	String currentPage="currentPage";
	String allPage="allPage";
	ArrayList<String> ClassoneAcList = obj.getAllclassOneAcByName(strCity,strCountry);
	ArrayList<String> timeList = new ArrayList<String>();
	timeList.add("天");
	timeList.add("小时");
	%>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>一级热点弱覆盖分析</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link href="../common/css/css.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../js/jquery-1.4.1.min.js"></script>
<script src="../include/DatePicker/WdatePicker.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</style>
 <link href="../jquerytable/Styles/Site.css" rel="stylesheet" type="text/css" />
 
    <script src="../jquerytable/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../jquerytable/Scripts/JQueryPlugin/TableSort.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tb").sorttable({
                ascImgUrl: "../jquerytable/Images/bullet_arrow_up.png",
                descImgUrl: "../jquerytable/Images/bullet_arrow_down.png",
                ascImgSize: "8px",
                descImgSize: "8px",
                sorttingMsg: "数据加载中...",
                sorttingMsgColor: "#FF6600",
                 maskOpacity: "0.6",
                 maskColor:"#D2F1FF",
                onSorted: function (cell) {
                  //  alert(cell.index() + " -- " + cell.text());
                }
            });
        });
    </script>
<script type="text/javascript">
 function showAc(){ 

  frm.action="poor_coverage_classoneac.jsp";
  frm.<%=com.ejoysoft.common.Constants.PAGE_SIZE_INDEX%>.value = "1";
  document.getElementById("classone").value=document.getElementById("classOneAc").value;
  frm.submit();
 }
 
  function toHotSpotTwo(classoneac){
  frm.action = "poor_coverage_classtwoac.jsp";
  frm.<%=com.ejoysoft.common.Constants.PAGE_SIZE_INDEX%>.value = "1";
  document.getElementById("strPageSize").value = "";
  document.getElementById("classone").value =classoneac;
  frm.submit();
}

function exportpage(currentPage)
{
frm.action = "poor_coverage_export.jsp";
document.getElementById("classone").value=document.getElementById("classOneAc").value;
document.getElementById("exportContent").value = currentPage;
  
frm.submit();
}
 
function clearInput(){
 	var selectId=document.getElementById('classOneAc');
 	for(var i=0;i<selectId.options.length;i++) 
	{ 
		if(selectId.options[i].text == "<%=classOneAc%>") 
		{ 
			selectId.options[i].selected = true; 
			//isExit = true; 
			break; 
		}else{
			selectId.options[0].selected = true; 
		} 
	}
	selectId=document.getElementById('timedegree');
 	for(var i=0;i<selectId.options.length;i++) 
	{ 
		if(selectId.options[i].text == "<%=timedegree%>") 
		{ 
			selectId.options[i].selected = true; 
			//isExit = true; 
			break; 
		}else{
			selectId.options[0].selected = true; 
		} 
	}
	document.getElementById("strStartTime").value="<%=strStartTime %>";
 	document.getElementById("strEndTime").value="<%=strEndTime %>";
 }
 function toUpLayer(strCity,country){
  frm.action = "poor_coverage_country.jsp";
  frm.<%=com.ejoysoft.common.Constants.PAGE_SIZE_INDEX%>.value = "1";
  document.getElementById("strPageSize").value = "";
  document.getElementById("city").value =strCity;
  document.getElementById("country").value ="";
  frm.submit();
}
 
</script>
</head>

<body onload="clearInput();">
<form name="frm" METHOD=POST ACTION="poor_coverage_classoneac.jsp">
<input id="city" name="city" type="hidden" value="<%=strCity %>"/>
<input id="country" name="country" type="hidden" value="<%=strCountry %>"/>
<input id="intCurPage" name="intCurPage" type="hidden" value="<%=intCurPage %>"/>
<input id="exportContent" name="exportContent" type="hidden" value=""/>
<input id="exportFlag" name="exportFlag" type="hidden" value="poor_coverage_classoneac"/>
<input id="classone" name="classone" type="hidden" value=""/>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="absbottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">专项优化</font> &gt; 弱覆盖分析</td>
  </tr>
</table>
<table  width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td height="45" valign="middle" bgcolor="e1eef7">
      <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td align="left" width="15%" height="40" > 一级热点<select id="classOneAc" name="classOneAc"   style="width:100px"  class="sel1"><option value=''>--请选择--</option>
        <% for (int j = 0; j <  ClassoneAcList.size(); j++) {
					String classoneac = (String)(ClassoneAcList.get(j));
					String selected = "";
					if(classOneAc!= null && classOneAc.equals(classoneac))
						selected = "selected='selected'";
				%>
				<option value="<%=classoneac%>" <%=selected%>>
					<%=classoneac%>
				</option>
				<%
				}
				%>
				          
         </select></td>
         
         <td align="right" width="65%" height="40">时间粒度<span class="STYLE1"></span>
          <select id="timedegree" name="timedegree" class="sel1">
          <option value="">--请选择--</option>
           <% for (int j = 0; j <  timeList.size(); j++) {
					String time = (String)(timeList.get(j));
					String selected = "";
					if(timedegree!= null && timedegree.equals(time))
						selected = "selected='selected'";
				%>
				<option value="<%=time%>" <%=selected%>>
					<%=time%>
				</option>
				<%
				}
				%>
          </select>
                    时间  <input id="strStartTime" name="strStartTime" type="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH.mm.ss'})" readonly="readonly" style="width:'20%'" value="<%=strStartTime%>"  class="sell"/>—<input id="strEndTime" name="strEndTime" type="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH.mm.ss'})" readonly="readonly" style="width:'20%'" value="<%=strEndTime%>"  class="sell"/>
         &nbsp;&nbsp;</td>
         <td style="width: 120px" width="15%"><img src="../images/search.jpg" width="58" height="28" onclick="showAc()" style="cursor:hand"/><img src="../images/cx22.jpg" width="58" height="28" border="0" style="cursor:hand" onclick="toUpLayer('<%=strCity%>')"/></td>
        </tr>
      </table></td>
  </tr>
</table>
<br/>
<table  id="tb" width="97%" border="0" align="center" cellpadding="0" cellspacing="0">

   <tr role="head">
    <td sort="true" width="7%" class="listtit">城市</td>
    <td sort="true" width="8%" class="listtit">区县</td>
    <td sort="true" width="8%" class="listtit">一级热点</td>
    <td sort="true" width="10%" class="listtit">二级热点数量</td>
    <td sort="true" width="6%" class="listtit">AP数量</td>
    <td sort="true" width="8%" class="listtit">是否弱覆盖</td>
    <td sort="true" width="8%" class="listtit">弱覆盖AP数</td>
        <td sort="true" width="7%" class="listtit">用户数</td>
    <td sort="true" width="7%" class="listtit">信噪比</td>
    <td sort="true" width="8%" class="listtit">场强</td>
    <td sort="true" width="8%" class="listtit">信道质量</td>
    <td width="10%" class="listtit">拓扑定位</td>
    <td sort="true" width="7%" class="listtit">下钻</td>
  </tr>
       <%
            for (int i = 0;i < vctObj.size(); i++) {
            	Poorcoverage2 obj1 = vctObj.get(i);
            	
            %>
  <tr>
     <td align="center" class="listd1"><%=obj1.getstrCity() %></td>
    <td align="center" class="listd1"><%=obj1.getstrProper() %></td>
    <td align="center" class="listd1"><%=obj1.gethotSpot() %></td>
    <td align="center" class="listdrd"><a href="#" onclick="toHotSpotTwo('<%=obj1.gethotSpot() %>')"><font color="#0066CC"><%=obj1.gethotSpot2acNum() %></font></a></td>
    <td align="center" class="listd1"><%=obj1.getapNumber() %></td>
    <td align="center" class="listd1"><%=obj1.getpoorCover() %></td>
    <td align="center" class="listd1"><%=obj1.getpoorCoverNum() %></td>
    <td align="center" class="listd1"><%=obj1.getuserNumber() %></td>
    <td align="center" class="listd1"><%=obj1.getnoiseRatio() %></td>
    <td align="center" class="listd1"><%=obj1.getfieldIntens () %></td>
    <td align="center" class="listd1"><%=obj1.getfrouteQuality() %></td>
   <td class="listdrd"> <a class="a1"href="#" onclick="window.parent.leftFrame.location='../left.jsp?actionFlag=拓扑呈现&rootFlag=日常管理';window.parent.mainFrame.location='../topology/allac_map.jsp?strClassOneAc=<%=obj1.gethotSpot() %>';"><img src="../images/map_blue.png" height="20" border="0" /></a></td>
   <td align="center" class="listdrd"><a href="#" onclick="toHotSpotTwo('<%=obj1.gethotSpot() %>')"><img src="../images/1-11112R01455.png" height="20" border="0" /></a></td>
    
  </tr>
         <%
            }
	         //关闭数据库连接对象
	        // globa.closeCon(); 
            %> 
  
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="61%" height="50" valign="bottom"><!--<img src="../images/pldel.jpg" width="83" height="27" align="absmiddle" />--> &nbsp;&nbsp;页面记录数
      <select name="strPageSize" id="strPageSize" style="width:52px;" onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		%>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>
		</select>
    <img src="../images/dc.jpg" width="92" height="27" align="middle"  onclick="exportpage('currentPage')" style="cursor:hand"/> <img src="../images/dcall.jpg" width="82" height="27" align="middle" onclick="exportpage('allPage')" style="cursor:hand"/></td>
    <td>  <input id="exportFlag" name="exportFlag" type="hidden" value="disturb_classoneac"/>
       		 <input id="strCurPage" name="strCurPage" type="hidden" value=""/>
			<input id="exportContent" name="exportContent" type="hidden" value=""/></td>
    <td width="39%" align="right" valign="bottom"><!--<table width="310" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="40"><img src="../images/up.jpg" width="40" height="30" /></td>
        <td width="221" align="center" background="../images/page_bg.jpg" class="page"><a href="#">1</a>&nbsp; <a href="#">2</a>&nbsp; <a href="#">3</a>&nbsp; <a href="#"><span class="sel">4</span></a>&nbsp; <a href="#">5</a> &nbsp;<a href="#">6</a> &nbsp;<a href="#">7</a>&nbsp; <a href="#">8 </a>&nbsp;<a href="#">9</a>&nbsp;...&nbsp;<a href="#">13</a> </td>
        <td width="39"><img src="../images/down.jpg" width="39" height="30" /></td>
      </tr>
    </table>-->
    <!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
    
  </tr>
</table>
</body>
</html>

<%@ include file="../include/jsp/footer.jsp"%>
